<template>
    <div class="interview-page">
        <!-- 页面标题 -->
        <div class="page-header">
            <h1>智能AI面试</h1>
            <p>针对性练习，提升面试能力</p>
        </div>

        <!-- 返回按钮 -->
        <div class="back-button" @click="showExitConfirm">
                <i class="back-icon"></i>
                <span>返回</span>
            </div>

        <!-- 分类项目网格 -->
        <div class="categories-grid">
            <!-- 自我介绍 -->
            <div class="category-card" @click="navigateToCategory(1)">
                <div class="category-icon blue">
                    <img src="@/assets/images/interview/self-intro.png" alt="自我介绍">
                </div>
                <div class="category-title">自我介绍</div>
                <div class="category-tags">
                    <span class="tag">大厂</span>
                </div>
            </div>

            <!-- 情景题 -->
            <div class="category-card" @click="navigateToCategory(2)">
                <div class="category-icon green">
                    <img src="@/assets/images/interview/scenario.png" alt="情景题">
                </div>
                <div class="category-title">情景题</div>
                <div class="category-tags">
                    <span class="tag">大厂</span>
                    <span class="tag">国央企</span>
                </div>
            </div>

            <!-- 项目介绍 -->
            <div class="category-card" @click="navigateToCategory(3)">
                <div class="category-icon teal">
                    <img src="@/assets/images/interview/project.png" alt="项目介绍">
                </div>
                <div class="category-title">项目介绍</div>
                <div class="category-tags">
                    <span class="tag">大厂</span>
                </div>
            </div>

            <!-- 薪资谈判 -->
            <div class="category-card" @click="navigateToCategory(4)">
                <div class="category-icon orange">
                    <img src="@/assets/images/interview/salary.png" alt="薪资谈判">
                </div>
                <div class="category-title">薪资谈判</div>
                <div class="category-tags">
                    <span class="tag">大厂</span>
                    <span class="tag">外企</span>
                </div>
            </div>

            <!-- 个人信息 -->
            <div class="category-card" @click="navigateToCategory(5)">
                <div class="category-icon purple">
                    <img src="@/assets/images/interview/personal-info.png" alt="个人信息">
                </div>
                <div class="category-title">个人信息</div>
                <div class="category-tags">
                    <span class="tag">大厂</span>
                    <span class="tag">国央企</span>
                </div>
            </div>

            <!-- 即兴演讲 -->
            <div class="category-card" @click="navigateToCategory(6)">
                <div class="category-icon blue-light">
                    <img src="@/assets/images/interview/speech.png" alt="即兴演讲">
                </div>
                <div class="category-title">即兴演讲</div>
                <div class="category-tags">
                    <span class="tag">国央企</span>
                    <span class="tag">银行</span>
                </div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router'

defineOptions({
    name: 'InterviewPage'
})

const router = useRouter()

//返回按钮
const showExitConfirm = () => {
    router.go(-1)
}

// 导航到具体类别的练习页面
const navigateToCategory = (categoryId) => {
    router.push({
        path: `/videoInterview`,
        query: { categoryId }
    })
}
</script>

<style lang="scss" scoped>
.interview-page {
    background: linear-gradient(135deg, #e6f3ff 0%, #b6d9ff 100%);
    min-height: 650px;
    padding: 20px;

    // 返回按钮
    .back-button {
            position: absolute;
            top: 15px;
            left: 15px;
            display: flex;
            align-items: center;
            background-color: rgba(0, 0, 0, 0.5);
            color: white;
            padding: 8px 12px;
            border-radius: 20px;
            cursor: pointer;
            z-index: 10;
            
            .back-icon {
                width: 8px;
                height: 8px;
                border-top: 2px solid white;
                border-left: 2px solid white;
                transform: rotate(-45deg);
                margin-right: 6px;
            }
            
            span {
                font-size: 14px;
            }
            
            &:hover {
                background-color: rgba(0, 0, 0, 0.7);
            }
        }

    .page-header {
        padding: 10px 0;
        text-align: center;

        h1 {
            font-size: 24px;
            color: #333;
            margin-bottom: 8px;
            font-weight: 600;
        }

        p {
            font-size: 14px;
            color: #666;
        }
    }

    .categories-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 5px;

        .category-card {
            background-color: #fff;
            border-radius: 16px;
            padding: 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            text-align: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
            transition: all 0.3s ease;
            cursor: pointer;

            &:hover {
                transform: translateY(-3px);
                box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
            }

            .category-icon {
                width: 60px;
                height: 60px;
                border-radius: 50%;
                display: flex;
                align-items: center;
                justify-content: center;
                margin-bottom: 12px;

                img {
                    width: 32px;
                    height: 32px;
                    object-fit: contain;
                }

                &.blue {
                    background-color: #e3f2fd;
                }

                &.green {
                    background-color: #e8f5e9;
                }

                &.teal {
                    background-color: #e0f2f1;
                }

                &.orange {
                    background-color: #fff3e0;
                }

                &.purple {
                    background-color: #f3e5f5;
                }

                &.blue-light {
                    background-color: #e1f5fe;
                }
            }

            .category-title {
                font-size: 16px;
                font-weight: 500;
                color: #333;
                margin-bottom: 8px;
            }

            .category-tags {
                display: flex;
                flex-wrap: wrap;
                justify-content: center;
                gap: 6px;

                .tag {
                    font-size: 10px;
                    color: #888;
                    background-color: #f5f5f5;
                    padding: 2px 8px;
                    border-radius: 10px;
                }
            }
        }
    }
}

// 响应式调整
@media (min-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
</style>